﻿using System;
using System.Text;
using System.IO;

namespace Halk.Utils
{
    public static class XFile
    {
        public static string ReadFile(string path)
        {
            var str = new StringBuilder();
            if (File.Exists(path))
            {
                using (var sr = new StreamReader(path))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                        str.Append(line);
                }
            }
            return str.ToString();
        }

        public static bool WriteFile(string path,string content)
        {
            using (var sw = new StreamWriter(path, false, Encoding.GetEncoding("utf-8")))
            {
                sw.Write(content);
                sw.Close();
            }
            return true;
        }
    }
}
